<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<title>TravelDream</title>
	<link rel="stylesheet" type="text/css" href="../style/prodottobase.css" />
</h:head>
<h:body>
<div id="main">
		<div id="upper">
			<div id="logo"><a href="/TravelDreamWeb/home.jsf"><img id="logo-img" src="../img/logo.png"/></a></div>
			<div id="login-up">Benvenuto, #{utenteBean.name} <br />
				<h:form><p:commandButton action="#{logoutBean.logout()}" value="Logout" />
				<h:link outcome="PaginaDatiPersonali" value="Modifica dati personali" /></h:form>
			</div>
		</div>
		<div id="center">
		<div id="center1">
			<p:outputLabel value="Voli inseriti: " /><br/>
			<h:form id="form">
				<p:dataTable style="width:870px" id="voloPanel" value="#{voloBean.listaVoli}" var="volo" emptyMessage="Nessun volo inserito."
					paginator="true" rows="10"  
                 	paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                	rowsPerPageTemplate="5,10,15">  
					<p:column headerText="Compagnia" >
						<h:outputText value="#{volo.compagnia}" />
					</p:column>
					<p:column headerText="Aeroporto di partenza">
						<h:outputText value="#{volo.aeroportoPartenza}" />
					</p:column>
					<p:column headerText="Aeroporto di arrivo">
						<h:outputText value="#{volo.aeroportoArrivo}" />
					</p:column>
					<p:column headerText="Codice volo">
						<h:outputText value="#{volo.codiceVolo}" />
					</p:column>
					<p:column headerText="Prezzo(€)">
						<h:outputText value="#{volo.prezzo}" />
					</p:column>
					<p:column  width="70">
					<p:column>  
                		<p:commandButton id="selectButton" update=":form:display" oncomplete="PF('voloDialog').show()" value="Modifica" title="View"
                			action="#{voloBean.setVolo(voloBean.getVoloSelected(volo.idVolo))}" >  
            			</p:commandButton>  
        			</p:column>
					</p:column>
					<p:column width="70">
						<p:commandButton value="Elimina" action="#{voloBean.elimina(volo.idVolo)}"/>
					</p:column>
					</p:dataTable> 
				
				<p:dialog header="Modifica volo" widgetVar="voloDialog" resizable="false"  id="voloDlg"  
                	showEffect="fade" hideEffect="drop" modal="true">  
        			<h:panelGrid id="display" columns="3" cellpadding="4" style="margin:0 auto;">  
        	
        				<h:outputText value=" " />  
        				<h:outputText value="Vecchio Valore" style="font-weight:bold"/>  
        				<h:outputText value="Nuovo Valore" style="font-weight:bold"/>  
  
   				        <h:outputText value="Compagnia:" style="font-weight:bold"/>  
            			<h:outputText value="#{voloBean.volo.compagnia}" /> 
            			<p:inputText value="#{voloBean.getVolo().compagnia}"  />
            
            			<h:outputText value="Aeroporto di partenza:" style="font-weight:bold"/>  
            			<h:outputText value="#{voloBean.volo.aeroportoPartenza}" />
            			<p:inputText value="#{voloBean.getVolo().aeroportoPartenza}" />           
  
  						<h:outputText value="Aeroporto di arrivo:" style="font-weight:bold"/>  
            			<h:outputText value="#{voloBean.volo.aeroportoArrivo}" /> 
            			<p:inputText value="#{voloBean.getVolo().aeroportoArrivo}" />
  
            			<h:outputText value="Codice volo:" style="font-weight:bold" />  
            			<h:outputText value="#{voloBean.volo.codiceVolo}" />
            			<p:inputText  value="#{voloBean.getVolo().codiceVolo}" />
          
          	 	 		<h:outputText value="Prezzo(€):" style="font-weight:bold"/>  
            			<h:outputText value="#{voloBean.volo.prezzo}" /> 
            			<p:inputText value="#{voloBean.getVolo().prezzo}" /> 
                     
            			<h:outputText value=" " />
            			<p:commandButton action="#{voloBean.modifica()}" value="Modifica" />
        			</h:panelGrid>  
   				</p:dialog>  	
   				<h:messages globalOnly="true"/>			
			</h:form>
			</div></div>
			<div id="footer">
				<h:link outcome="PaginaPrincipale" value="Torna alla pagina principale" />
			</div>
		</div>
</h:body>
</html>